package com.telit.common.config;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
import com.telit.common.service.AliPushMessageService;
import com.telit.common.service.AliSmsService;
import com.telit.common.service.ParamsCheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * @Auther amy
 * @Describe
 */
@Configuration
public class EnableAliyunConfiguation {

    @Autowired
    private PushMessageProperties pushMessageProperties;

    @Autowired
    private AliSmsService aliSmsService;

    @Autowired
    private ParamsCheckService paramsCheckService;

    @Autowired
    private AliPushMessageService aliPushMessageService;

    @Bean
    public DefaultAcsClient defaultAcsClient(){
        IClientProfile profile = DefaultProfile.getProfile(pushMessageProperties.getRegionId(), pushMessageProperties.getAccessKeyId(), pushMessageProperties.getAccessKeySecret());
        return new DefaultAcsClient(profile);
    }

    // 当该项目单独拉出来做成jar引入别的服务，以下注释掉的bean初始化还是需要
    /**
     * 静态方法里面的service注解还需要再引入一次
     * @return
     */
//    @Bean
//    public AliSmsUtils aliSmsUtils(){
//        return new AliSmsUtils(aliSmsService);
//    }
//
//    @Bean
//    public AliyunPushMessageUtils aliyunPushMessageUtils(){
//        return new AliyunPushMessageUtils(paramsCheckService,aliPushMessageService);
//    }
//
//    @Bean
//    public PushMessageProperties pushMessageProperties(){
//        return new PushMessageProperties();
//    }
//
//    @Bean
//    public AliSmsService aliSmsService(){
//        return new AliSmsService();
//    }
//
//    @Bean
//    public ParamsCheckService paramsCheckService(){
//        return new ParamsCheckService();
//    }
//
//    @Bean
//    public AliPushMessageService aliPushMessageService(){
//        return new AliPushMessageService();
//    }
}
